<template>
  <div>
    <el-form :inline="true">
      <el-form-item label="优惠券状态">
        <el-select v-model="form.region" size="mini" placeholder="请选择活动区域">
          <el-option label="未发放" value="weifa"></el-option>
          <el-option label="领取中" value="lingqu"></el-option>
          <el-option label="已结束" value="weifa"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="优惠券名称">
        <el-input placeholder="请输入内容" size="mini"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button size="mini">搜索</el-button>
      </el-form-item>
      <el-form-item>
        <el-button size="mini">重置</el-button>
      </el-form-item>
    </el-form>
    <el-button type="primary" size="mini" @click="$router.push({name:'addyouhui'})">新建优惠卷</el-button>
    <el-table :data="list" border style="width: 100%">
      <el-table-column prop="name" label="优惠卷名称" width="180">
      </el-table-column>
      <el-table-column label="使用范围">
        <template slot-scope="scope">
          {{ scope.row.dis_type==1?'班级':'图书'}}/
          <span v-show="scope.row.scope_type==1">全部课程</span>
          <span v-show="scope.row.scope_type==2">指定分类 </span>
          <span v-show="scope.row.scope_type==3">指定课程 </span>
        </template>
      </el-table-column>
      <el-table-column prop="created_at" label="有效期">
        <template slot-scope="scope">
          {{ scope.row.created_at|formatDate}}
        </template>
      </el-table-column>
      <el-table-column prop="receive_type" label="领取/发放">
        <template slot-scope="scope">
          {{ scope.row.draw_num}}/{{scope.row.num}}
        </template>
      </el-table-column>
      <el-table-column prop="valid_day" label="状态">
        <template slot-scope="scope">
          {{ scope.row.receive_type?'领取中':''}}
        </template>
      </el-table-column>
      <el-table-column prop="status" label="类型">
        <template slot-scope="scope">
          {{ scope.row.status?'领取':''}}
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      list: [],
      form: {
        region: "",
      },
    };
  },
  mounted() {
    axios.get("/coupon").then((res) => {
      console.log(res);
      this.list = res.data.list;
    });
  },
  methods: {},
};
</script>

<style lang='scss'>
</style>
